Skip to content

Conversation

@jerryyin
Copy link
Member

@jerryyin jerryyin commented Aug 14, 2025

In different build environments when building with python bindings, LLVM build occasionally fail on not being able to find the pybind package. Adding this help LLVM find it and fix the build failure for me.

@llvmbot llvmbot added the mlir label Aug 14, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 14, 2025

@llvm/pr-subscribers-mlir

Author: Zhuoran Yin (jerryyin)

Changes

In different build environments, LLVM build occasionally fail on not being able to find the pybind package. Adding this help LLVM find it and fix the build failure for me.


Full diff: https://github.com/llvm/llvm-project/pull/153579.diff

1 Files Affected:

  • (modified) mlir/cmake/modules/AddMLIRPython.cmake (+1)
diff --git a/mlir/cmake/modules/AddMLIRPython.cmake b/mlir/cmake/modules/AddMLIRPython.cmake
index c14e614ed7d92..4354af8792f33 100644
--- a/mlir/cmake/modules/AddMLIRPython.cmake
+++ b/mlir/cmake/modules/AddMLIRPython.cmake
@@ -661,6 +661,7 @@ function(add_mlir_python_extension libname extname)
   # sources that must be compiled in accordance with pybind11 needs (RTTI and
   # exceptions).
   if(NOT DEFINED ARG_PYTHON_BINDINGS_LIBRARY OR ARG_PYTHON_BINDINGS_LIBRARY STREQUAL "pybind11")
+    find_package(pybind11 REQUIRED)
     pybind11_add_module(${libname}
       ${ARG_SOURCES}
     )

@jerryyin jerryyin changed the title [Build] Adding find_package for pybind [MLIR][Build] Adding find_package for pybind Aug 14, 2025
@makslevental
Copy link
Contributor

don't we have this already here?

find_package(pybind11 2.10 CONFIG REQUIRED)

you're probably having this issue because IREE does MLIR_DISABLE_CONFIGURE_PYTHON_DEV_PACKAGES=ON

https://github.com/iree-org/iree/blob/cc1a7dda09b97dd22a810c35aa039b00379c1c67/build_tools/cmake/iree_llvm.cmake#L181

so just do MLIR_DISABLE_CONFIGURE_PYTHON_DEV_PACKAGES=OFF in your cmake config and it should work.

@jerryyin
Copy link
Member Author

@makslevental It is cool to know the context! Thanks for the pointers.

I think the only problem then is that in IREE this is set with FORCE making my overriding attempt unsuccesful.

set(MLIR_DISABLE_CONFIGURE_PYTHON_DEV_PACKAGES ON CACHE BOOL "" FORCE)

It looks like I need to get rid of FORCE in IREE so that I can manually override it to OFF.

jerryyin added a commit to iree-org/iree that referenced this pull request Aug 14, 2025
…_PACKAGES

This dropped the FORCE from the `MLIR_DISABLE_CONFIGURE_PYTHON_DEV_PACKAGES`. Or else a developer is not able to override it when running into build failures related with python packages. 

For context refer to llvm/llvm-project#153579
@jerryyin
Copy link
Member Author

Closing as not relevant, build failure cleared to me once I turn off MLIR_INCLUDE_TESTS

@jerryyin jerryyin closed this Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants